<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
	<title>Client List</title>
	<style  type = "text/css">
		body
		{

			font-family: helvetica;
			margin-right: 5%;
			margin-left: 5%;
		}
	</style>
</head>

<body>
	<?php
		// Create database connection reference
		$connect = mysql_connect("localhost", "mikebrennan", "plant")
			or die ("Could not connect to server");
		mysql_select_db("snake");

		$sql = "SHOW TABLES FROM snake";
		$result = mysql_query($sql);

		while ($bow = mysql_fetch_row($result))
		{
			$searchstring = "SELECT * from $bow[0]";
			$selectresult = mysql_query($searchstring) or die(mysql_error());

			echo "<h1>$bow[0]</h1>";
			echo "<table width='800px' border='2' cellspacing='2' cellpadding='1'>";
			echo "<tr>";
			$x = mysql_num_fields($selectresult);
			for($i=0; $i<$x; $i++)
			{
				$meta = mysql_fetch_field($selectresult, $i);
				echo "<th width='400px' valign='center' align='left'>$meta->name</th>";
			}
			echo "</tr>";
			while ($row = mysql_fetch_array($selectresult))
			{
				echo "<tr>";
				$x = mysql_num_fields($selectresult);
				for($i=0; $i<$x; $i++)
				{
					$id = $row[$i];
					echo "<td width='100px' valign='center' align='left'>$id</td>";
				}
				echo "</tr>";

			}
			echo "</table>";
		}

	?>

</body>
</html>